package GUI;

import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;

import javax.swing.JFrame;
import javax.swing.JPanel;





/**
 * @author marioromero
 * panel principal del administrador
 *
 */
public class panelAdministradorPrincipal extends javax.swing.JPanel implements
		ActionListener, ItemListener {

	/**
	 * variables estaticas
	 */
	private static final long serialVersionUID = -5738566078902054948L;



	/** Constructor del panel administrador principal */

	public panelAdministradorPrincipal() {
		initComponents();
	}

	private void initComponents() {

		botonSalir = new javax.swing.JButton();
		bTitulo = new javax.swing.JButton();
		panelCentro2 = new javax.swing.JPanel();
		rbSugerencias = new javax.swing.JRadioButton();
		rbGestion = new javax.swing.JRadioButton();
		bAtras = new javax.swing.JButton();

		setBackground(new java.awt.Color(255, 255, 255));

		botonSalir.setIcon(new javax.swing.ImageIcon(
				"src/GUI/resources/menu-salir.png")); // NOI18N
		botonSalir.setBorderPainted(false);
		botonSalir.setBackground(new java.awt.Color(255, 255, 255));
		botonSalir.addActionListener(this);

		bTitulo.setIcon(new javax.swing.ImageIcon(
				"src/GUI/resources/encabezadoMain.png"));
		bTitulo.setBorder(null);
		bTitulo.setBorderPainted(false);
		bTitulo.setBackground(new java.awt.Color(255, 255, 255));
		bTitulo.addActionListener(this);

		panelCentro2.setBackground(new java.awt.Color(255, 255, 255));

		org.jdesktop.layout.GroupLayout panelCentro2Layout = new org.jdesktop.layout.GroupLayout(
				panelCentro2);
		panelCentro2.setLayout(panelCentro2Layout);
		panelCentro2Layout.setHorizontalGroup(panelCentro2Layout
				.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
				.add(0, 673, Short.MAX_VALUE));
		panelCentro2Layout.setVerticalGroup(panelCentro2Layout
				.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
				.add(0, 430, Short.MAX_VALUE));

		rbSugerencias.setFont(new java.awt.Font("Lucida Handwriting", 1, 13)); // NOI18N
		rbSugerencias.setForeground(new java.awt.Color(243, 15, 120));
		rbSugerencias.setText("SUGERENCIAS");
		rbSugerencias.addItemListener(this);
		rbSugerencias.setBackground(new java.awt.Color(255, 255, 255));

		rbGestion.setFont(new java.awt.Font("Lucida Handwriting", 1, 13)); // NOI18N
		rbGestion.setForeground(new java.awt.Color(243, 15, 120));
		rbGestion.setText("GESTION");
		rbGestion.addItemListener(this);
		rbGestion.setBackground(new java.awt.Color(255, 255, 255));

		bAtras.setIcon(new javax.swing.ImageIcon(
				"src/GUI/resources/boton_atras.png")); // NOI18N
		bAtras.setBorder(null);
		bAtras.setBackground(new java.awt.Color(255, 255, 255));

		org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(
				this);
		this.setLayout(layout);
		layout.setHorizontalGroup(layout
				.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
				.add(layout
						.createSequentialGroup()
						.addContainerGap()
						.add(layout
								.createParallelGroup(
										org.jdesktop.layout.GroupLayout.LEADING)
								.add(rbGestion).add(rbSugerencias).add(bAtras))
						.add(18, 18, 18)
						.add(panelCentro2,
								org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
								org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
								org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
						.addContainerGap(18, Short.MAX_VALUE))
				.add(layout
						.createSequentialGroup()
						.add(96, 96, 96)
						.add(bTitulo)
						.addPreferredGap(
								org.jdesktop.layout.LayoutStyle.RELATED,
								org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
								Short.MAX_VALUE).add(botonSalir)));
		layout.setVerticalGroup(layout
				.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
				.add(layout
						.createSequentialGroup()
						.add(6, 6, 6)
						.add(layout
								.createParallelGroup(
										org.jdesktop.layout.GroupLayout.LEADING)
								.add(bTitulo,
										org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
										104,
										org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
								.add(botonSalir))
						.addPreferredGap(
								org.jdesktop.layout.LayoutStyle.RELATED)
						.add(layout
								.createParallelGroup(
										org.jdesktop.layout.GroupLayout.LEADING)
								.add(layout
										.createSequentialGroup()
										.add(rbSugerencias)
										.add(18, 18, 18)
										.add(rbGestion)
										.addPreferredGap(
												org.jdesktop.layout.LayoutStyle.RELATED,
												org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
												Short.MAX_VALUE).add(bAtras)
										.add(14, 14, 14))
								.add(layout
										.createSequentialGroup()
										.add(panelCentro2,
												org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
												org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
												org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
										.addContainerGap(
												org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
												Short.MAX_VALUE)))));
	}

	private javax.swing.JButton bAtras;
	private javax.swing.JButton bTitulo;
	private javax.swing.JButton botonSalir;
	private javax.swing.JPanel panelCentro2;
	private javax.swing.JRadioButton rbGestion;
	private javax.swing.JRadioButton rbSugerencias;
	private JFrame actual;
	private JPanel estePanel = this;

	

	/* (non-Javadoc)
	 * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)
	 */
	public void itemStateChanged(ItemEvent e) {
		if (e.getSource() == rbSugerencias) {

			actual = (JFrame) UtilidadesGUI.getContenedorPrincipal(estePanel);
			actual.getContentPane().remove(0);
			actual.getContentPane().add(new panelAdministradorSugerencias());
			actual.setPreferredSize(new Dimension(850, 630));
			actual.pack();
			actual.repaint();
			UtilidadesGUI.CentrarPantalla(actual);
		}

		if (e.getSource() == rbGestion) {

			actual = (JFrame) UtilidadesGUI.getContenedorPrincipal(estePanel);
			actual.getContentPane().remove(0);
			actual.getContentPane().add(
					new panelAdministradorGestionProductos());
			actual.setPreferredSize(new Dimension(850, 630));
			actual.pack();
			actual.repaint();
			UtilidadesGUI.CentrarPantalla(actual);
		}
		

	}

	
	/* (non-Javadoc)
	 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
	 */
	public void actionPerformed(ActionEvent e) {
		if (e.getSource() == botonSalir) {
			actual = (JFrame) UtilidadesGUI.getContenedorPrincipal(estePanel);
			actual.getContentPane().remove(0);
			actual.getContentPane().add(new panelSalir(25));
			actual.setPreferredSize(new Dimension(610, 330));
			actual.pack();
			actual.repaint();
			UtilidadesGUI.CentrarPantalla(actual);

		}

	}
}
